package com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

@Entity
@Data
@Table(name = "t_gw_flow_form_event_improve")
@org.hibernate.annotations.Table(appliesTo = "t_gw_flow_form_event_improve",comment = "事件管理流程form表单")
public class FlowFormEventImprove implements Serializable {

    @ApiModelProperty(value = "流程ID")
    @Id
    @Column(name = "process_id", columnDefinition = "varchar(60) comment '产品唯一编码'")
    private String processId;


    /**
     * 流程标题
     */
    @ApiModelProperty(value = "流程标题")
    @Column(name = "process_title", columnDefinition = "varchar(1024) comment '流程标题'")
    String processTitle;


    //事件流程会触发整改流程，这个字段保存这个关系
    @ApiModelProperty(value = "整改流程由哪个整改措施触发")
    @Column(name = "from_improve_id", columnDefinition = "INT comment '产品唯一编码'")
    private Integer fromImproveId;

    @ApiModelProperty(value = "关联事件id")
    @Column(name = "from_event_process_id", columnDefinition = "varchar(100) comment '关联事件id'")
    private String fromEventProcessId;

    @ApiModelProperty(value = "关联事件标题")
    @Column(name = "from_event_process_title", columnDefinition = "varchar(1024) comment '关联事件标题'")
    private String fromEventProcessTitle;

    @ApiModelProperty(value = "创建时间")
    @org.hibernate.annotations.CreationTimestamp
    @Column(name = "process_create_time", columnDefinition = "datetime comment '发起时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime processCreateTime;

    @ApiModelProperty(value = "发起人部门名称")
    @Column(name = "flow_creator_department", columnDefinition = "varchar(30) comment '发起人部门名称'")
    String flowCreatorDepartment;

    /**
     * 流程创建人姓名
     */
    @ApiModelProperty(value = "流程创建人姓名")
    @Column(name = "flow_create_operator_name", columnDefinition = "varchar(30) comment '事件管理员名称'")
    String flowCreateOperatorName;


    /**
     * 流程创建人OA账号
     */
    @ApiModelProperty(value = "流程创建人OA账号")
    @Column(name = "flow_create_operator_account", columnDefinition = "varchar(30) comment '事件管理员id'")
    String flowCreateOperatorAccount;


    /**
     * 整改内容
     */
    @ApiModelProperty(value = "整改内容")
    @Column(name = "improve_content", columnDefinition = "text comment '整改内容'")
    private String improveContent;

    /**
     * 整改负责人账号
     */
    @ApiModelProperty(value = "整改负责人账号")
    @Column(name = "improve_person_list", columnDefinition = "varchar(100) comment '整改负责人账号多个，号分隔'")
    String improvePersonList;

    /**
     * 整改负责人姓名
     */
    @ApiModelProperty(value = "整改负责人姓名")
    @Column(name = "improve_person_name_list", columnDefinition = "varchar(100) comment '整改负责人姓名多个，号分隔'")
    String improvePersonNameList;

    @ApiModelProperty(value = "计划完成时间")
    @Column(name = "plan_date", columnDefinition = "char(10) comment '计划完成时间'")
    protected String planDate;

    @ApiModelProperty(value = "实际完成时间")
    @Column(name = "finish_date", columnDefinition = "char(10) comment '实际完成时间'")
    protected String finishDate;

    /**
     * 整改状态，1-待整改，2-整改完毕，3-取消
     */
    @ApiModelProperty(value = "整改状态")
    @Column(name = "improve_state", columnDefinition = "varchar(10) comment '录入后为待确认状态，负责人确认改为执行，团队负责人确认改成完成。" +
            "或为取消状态'")
    private String improveState;

    @Column(name = "insert_time", columnDefinition = "datetime comment '创建时间'")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime insertTime;

    @Column(name = "update_time", columnDefinition = "datetime comment '更新时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime updateTime;

    @ApiModelProperty(value = "是否完成")
    @Column(name = "is_close", columnDefinition = "int(2) comment '是否完成0 未完成 1已完成'")
    private int isClose = 0;

}
